{% extends 'layout.html' %}

{% block title %}{% endblock %}

{% block css %}

{% endblock %}

{% block content %}

<div id="wrap">
    <section class="section web-modules modules-sidebar-layout container j-modules-wrap" id="modules-13">
        <div class="main j-modules-inner">
            <section class="section web-modules modules-main-list" id="modules-12">
                <div class="layui-tab layui-tab-brief">
                    <ul class="layui-tab-title">
                        <li class="layui-this">首页</li>
                        <!-- <li>标签2</li> -->
                    </ul>
                    <div class="layui-tab-content">
                        <div class="layui-tab-item   layui-show">
                            <!-- <li class="item">
                                <div class="item-inner">
                                    <div class="item-img">
                                        <a class="item-thumb" href="/yyty/news/info/" title="科技晚报：富途控股在美上市 丰田品牌在">
                                            <img class="attachment-post-thumbnail size-post-thumbnail wp-post-image j-lazy"
                                                alt="科技晚报：富途控股在美上市 丰田品牌在" src="/static/images/15J231235D30-1L595.jpg"> </a>
                                    </div>
                                    <h2 class="item-title"> <a href="/yyty/news/info/"> 科技晚报：富途控股在美上市 丰田品牌在 </a></h2>
                                    <div class="item-meta-author">
                                        <a class="avatar j-user-card"> <span>点击:1次</span> </a>
                                        <div class="item-meta-right">
                                            时间：2021年08月03日
                                        </div>
                                    </div>
                                </div>
                            </li> -->
                            <ul class="post-loop post-loop-image cols-3 tab-wrap" id="ID-flow-demo"> 
                                <!-- {% for obj in data.results %}
                                <li class="item">
                                    <div class="item-inner">
                                        <div class="item-img">
                                            <a class="item-thumb" href="/yyty/news/info/?pid={{obj.topicId}}"
                                                title="{{obj.title}}">
                                                <img class="attachment-post-thumbnail size-post-thumbnail wp-post-image j-lazy"
                                                    alt="{{obj.title}}" data-src="{{obj.attachments.0.remoteUrl}}"> </a>
                                        </div>
                                        <h2 class="item-title"> <a href="/yyty/news/info/?pid={{obj.topicId}}">
                                                {{obj.title}} </a></h2>
                                        <div class="item-meta-author">
                                            <div class="item-meta-right">
                                                时间：{{obj.lastCommentTime}}
                                            </div>
                                        </div>
                                    </div>
                                </li>
                                {% endfor %} -->
                            </ul>
                        </div>
                        <!-- <div class="layui-tab-item">内容-2</div> -->
                    </div>
                </div>
            </section>
        </div>
        <!-- {% include "zujian/aside.html" %} -->
    </section>



</div>

{% endblock %}

{% block js %}

<script>
    const generator = new UniqueRandomGenerator(1, 50);
    window.onload = function () {
        
 

        layui.use(function () {
            var flow = layui.flow;
            // 流加载实例
            flow.load({
                elem: '#ID-flow-demo', // 流加载容器
                // scrollElem: '#ID-flow-demo', // 滚动条所在元素，一般不用填，此处只是演示需要。
                done: function (page, next) { // 执行下一页的回调
                    let lis = [];
                    // 模拟数据插入
                    // next(lis.join(''), page < 10); // 此处假设总页数为 10
                    // item.attachments[0].remoteUrl,this
                    axios({
                        url:"{{Domain}}haijiao/v1/card/list/",
                        method: "GET",
                        params:{
                            "Page": generator.generateUniqueRandom(),
                            "BanKuaiId": 1
                        }
                    }).then(res => {
                        res.data.results.map((item,index) => {
                            let sghjass = "";
                            if (item.attachments != null) {
                                item.attachments.length <= 0? sghjass = "https://p.hjpfe1.com/hjstore/images/20240409/1fc76f4264e5104f42ab54916189665a_mini.jpg.txt" : sghjass = item.attachments[0].remoteUrl
                            } else {
                                sghjass = "https://p.hjpfe1.com/hjstore/images/20240409/1fc76f4264e5104f42ab54916189665a_mini.jpg.txt" 
                            }
                            let a =  `
                            <li class="item">
                                    <div class="item-inner">
                                        <div class="item-img">
                                            <a class="item-thumb" href="/yyty/news/info/?pid=${item.topicId}"
                                                title="${item.title}">
                                                <img class="attachment-post-thumbnail size-post-thumbnail wp-post-image j-lazy"
                                                    alt="${item.title}" data-src="${sghjass}"> </a>
                                        </div>
                                        <h2 class="item-title"> <a href="/yyty/news/info/?pid=${item.topicId}">
                                            ${item.title} </a></h2>
                                        <div class="item-meta-author">
                                            <div class="item-meta-right">
                                                时间：${item.lastCommentTime}
                                            </div>
                                        </div>
                                    </div>
                                </li>
                            `;
                            lis.push(a);
                        });
                        next(lis.join(''), page < res.data.page.total);
                        let imgarr = document.querySelectorAll("#ID-flow-demo img");
                        for (let i = 0; i < imgarr.length; i++) {
                            const element = imgarr[i].dataset.src;
                            p(element,imgarr[i])
                            
                        }
                    }).catch(error => {
                        console.error("请求失败",error);
                    });

                    
                }
            });
        });
    
    
    
    }

</script>
{% endblock %}